<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/common/common.jsp"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="width=device-width, initial-scale=1.0">
<title>借用管理-新增</title>

<link href="https://cdn.bootcss.com/flatpickr/4.6.3/flatpickr.min.css"
	rel="stylesheet">
<script src="https://cdn.bootcss.com/flatpickr/4.6.3/flatpickr.min.js" ></script>

<link href="<%=path %>/css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<%=path %>/third/jquery-validation-1.14.0/lib/jquery.js"></script>
<script type="text/javascript" src="<%=path %>/js/common.js"></script>

<script type="text/javascript" src="<%= basePath%>third/jquery-validation-1.14.0/dist/jquery.validate.js"></script>
<script type="text/javascript" src="<%= basePath%>third/jquery-validation-1.14.0/dist/localization/messages_zh.js"></script>
<script type="text/javascript">
        $(function(){
			//如果是新增成功，会返回1，如果是1，则提示保存成功
			if("1" == "${actionState}"){
				alert('保存成功！');
			}
            $("#commonform").validate({
                errorClass: "errorInfo", //默认为错误的样式类为：error
                focusInvalid: false, //当为false时，验证无效时，没有焦点响应  
                onkeyup: false,   
                submitHandler: function(form){   //表单提交句柄,为一回调函数，带一个参数：form   
					checkFrom();
                    form.submit();   //提交表单   
                },   
                rules:{
               		 "sysBorrow.id":{
                        required:true
                    },
                	"sysBorrow.b_id":{
                		required:true
                	},
                    "sysBorrow.b_number":{
                        required:true
                    },
                    "sysBorrow.b_starttime":{
                        required:true
                    },
                    "sysBorrow.b_endtime":{
                        required:true
                    },
                     "sysBorrow.bstate":{
                        required:true
                    },
                     "sysBorrow.e_id":{
                        required:true
                    },
                     "sysBorrow.ea_id":{
                        required:true
                    },
                     "sysBorrow.bd_id":{
                        required:true
                    },
                    
                },
                messages:{
                	"sysBorrow.id":{
                        required:"必填",
                    },
                	"sysBorrow.b_id":{
                        required:"必填",
                    },
                    "sysBorrow.b_number":{
                        required:"必填",
                    },
                    "sysBorrow.b_starttime":{
                        required:"必填",
                    },
					"sysBorrow.b_endtime":{
                        required:"必填",
                    },
                    "sysBorrow.bstate":{
                        required:"必填",
                    },
                    "sysBorrow.e_id":{
                        required:"必填",
                    },
                    "sysBorrow.ea_id":{
                        required:"必填",
                    },
                    "sysBorrow.bd_id":{
                        required:"必填",

                    },
                  }
            });    
        });
        </script>
</head>
<body>

	<div class="place">
    <span>位置：</span>
    <ul class="placeul">
    <li><a href="#">首页</a></li>
    <li><a href="#">借用与维修管理</a></li>
    <li><a href="#">新增借用信息</a></li>
    </ul>
    </div>
    
    <div class="formbody">
    
    <div class="formtitle"><span>借用基本信息</span></div>
    <form action="<%= basePath%>/biz/SysBorrow_add.action" method="post" id="commonform">
    <ul class="forminfo">
    <li><label>ID序号</label><input name="id" id="id" type="text"  class="dfinput"/><i><font color="#FF0000" value="样例:1" onclick="JavaScript:this.value=''">*必填</font></i></li>
    <li><label>借用编号</label><input name="b_id" id="b_id" type="text"  class="dfinput"/><i><font color="#FF0000" value="样例:AC191210" onclick="JavaScript:this.value=''">*必填</font></i></li>
    <li><label>借用数量</label><input name="b_number" id="b_number" type="number" class="dfinput" /><i><font color="#FF0000">*必填</font></i></li>
    <li><label>借用日期</label><input name="b_starttime" id="b_starttime" class="flatpickr flatpickr-input" type="text"  readonly="readonly" /><i><font color="#FF0000">*必填</font></i></li>
   	<li><label>归还日期</label><input name="b_endtime" id="b_endtime" class="flatpickr flatpickr-input" type="text"  readonly="readonly" /><i><font color="#FF0000">*必填</font></i></li>
   	<li><label>设备编号</label><input name="e_id" id="e_id" type="text" class="dfinput" /><i><font color="#FF0000" value="样例:AA11111" onclick="JavaScript:this.value=''">*必填</font></i></li>
   	<li><label>附件编号</label><input name="ea_id" id="ea_id" type="text" class="dfinput" /><i><font color="#FF0000" value="样例:AA00000" onclick="JavaScript:this.value=''">*必填</font></i></li>
   	<li><label>部门编号</label><input name="bd_id" id="bd_id" type="text" class="dfinput" /><i><font color="#FF0000" value="样例:NT32-1" onclick="JavaScript:this.value=''">*必填</font></i></li>
   <li><label><font style="font-weight: #FF0000">借用状态</font></label>
        <label><input class="radio1"  type ="radio" name="bstate"  value="1" ></input>已归还</label> 
        <label><input class="radio1"  type ="radio" name="bstate"  value="2" ></input>正在借用</label> 
    </li>
    <li> <br/><br/><label>&nbsp;</label><input name="add_btn" type="submit" class="btn" value="确认保存"/></li>
    </ul>
    </form>
    
    </div>


</body>

	<script type="text/javascript">
    	document.getElementsByClassName("myClass").flatpickr({
    		enableTime: true,
    		time_24hr: true,
    	});
    	document.getElementById("b_starttime").flatpickr();
    	document.getElementById("b_endtime").flatpickr();
    </script>
    
</html>
